import React, { useState, useEffect, useRef } from 'react';
import { Button } from 'antd';
import Eventproxy from 'eventproxy';
var ep = new Eventproxy();

var func = () => {
  console.log('111111');
};

var func2 = () => {
  console.log('2222222');
};

export default props => {
  useEffect(() => {
    ep.on('aaa', func);
    ep.on('aaa', func2);
    setInterval(() => {
      ep.emit('aaa');
    }, 1000);

    setTimeout(() => {
      ep.removeListener('aaa', func);
    }, 3000);
  }, []);
  return (
    <div>
      <Button>ep</Button>
    </div>
  );
};
